Hydrocarbons, such as oil and gas, are produced from subterranean formations. The formations include many pores that include hydrocarbons. The hydrocarbons are recovered by drilling a wellbore that traverses the subterranean formation. The hydrocarbons migrate through connected pores and fractures within the subterranean formation and into the wellbore, where they travel to the surface. Generally, the more permeable a formation is, the more easily the hydrocarbons pass through the formation and into the wellbore. Conventional reservoirs are relatively permeable so hydrocarbons pass more easily into the wellbore. However, unconventional reservoirs, such as organic shale formations, are less permeable. In particular, organic shale formations include immobile organic matter that can block the flow of hydrocarbons between and through pores within the formation.